<div class="flexform">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'web-price-form',
        'enableAjaxValidation' => false
            ));
    ?>
    <div class="row">
        <?php echo $form->labelEx($model, 'site_id'); ?>
        <?php echo $form->dropDownList($model, 'site_id', CHtml::listData(Subsite::model()->findAll(), 'id', 'domain')); ?>
        <?php echo $form->error($model, 'site_id', array('class' => 'form-msg-error-advanced')); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'game_id'); ?>
        <?php
        echo $form->dropDownList($model, 'game_id', array(''=>'--选择游戏--')+ProductCategory::model()->getAllGameSelect(), array(
            'onchange' => 'setZone(this)',
        ));
        ?>
        <?php echo $form->error($model, 'game_id', array('class' => 'form-msg-error-advanced')); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'zone_id'); ?>
        <?php echo $form->dropDownList($model, 'zone_id', array('-选择服务区-')); ?>
        <?php echo $form->error($model, 'zone_id', array('class' => 'form-msg-error-advanced')); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'product_type'); ?>
        <?php echo $form->dropDownList($model, 'product_type', $this->model_array); ?>
        <?php echo $form->error($model, 'product_type', array('class' => 'form-msg-error-advanced')); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'where'); ?>
        <?php echo $form->textArea($model, 'where', array('rows' => 6, 'cols' => 60, 'class' => 'tip', 'title' => '说明：$p 价格 可用> < = >= <=, $p>10(价格大于10), 条件为空表示所有，多条件用&&或者||连接 ')); ?>
        <?php echo $form->error($model, 'where', array('class' => 'form-msg-error-advanced')); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'function'); ?>
        <?php echo $form->textArea($model, 'function', array('rows' => 6, 'cols' => 60, 'class' => 'tip', 'title' => '说明：+1.2(价格加1.2), -1.2(价格减1.2), *0.8(价格打8折)')); ?>
        <?php echo $form->error($model, 'function', array('class' => 'form-msg-error-advanced')); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'state'); ?>
        <?php echo $form->dropDownList($model, 'state', array('1' => '激活', '0' => '禁用')); ?>
        <?php echo $form->error($model, 'state', array('class' => 'form-msg-error-advanced')); ?>
    </div>

    <div class="action">
        <?php echo CHtml::submitButton($model->isNewRecord ? '创建' : '保存'); ?>
    </div>
    <?php $this->endWidget(); ?>
</div><!-- form -->
<div class="clear"></div>
<script>
    function setZone(obj){
        var url = "<?php echo $this->createUrl('productCategory/getZone') ?>";
        var gId = $(obj).val();
        var toObj = $("#WebPrice_zone_id");
        toObj.html('<option value="">-选择服务区-</option>');
        if(gId){
            $.get(url, {'gId':gId}, function(rdata){
                toObj.append(rdata);
            })
        }else{
            toObj.app('<option value="">-选择服务区-</option>');
        }
   
    }
</script>